﻿@model IEnumerable<IBS.Model.Client>

@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Clients/_ClientsLayout.cshtml";
}

<h2>IBank Clients</h2>

<form id="filterForm" method="post" action="/Clients/Index">
    
    <span>First Name: </span>
    <input id="firstName" name="firstName" type="text" value="@ViewBag.FirstName"/>
    <span>Last Name:</span>
    <input id="lastName" name="lastName" type="text" value="@ViewBag.LastName" />
    <br />
    
    <input type="submit" value="Filter" />
</form>

<div style="margin-bottom: 10px;">
    <a class="button" href="/Clients/NewClient">Add New Client</a>
</div>

@{
    var grid = new WebGrid(
        source: Model,
        rowsPerPage: 10);
}

@grid.GetHtml(
    tableStyle: "grid",
    headerStyle: "header",
    rowStyle: "row",
    footerStyle: "footer",
    alternatingRowStyle: "row",
    columns: grid.Columns (
        grid.Column("Id", "UID", style:"numberCol"),
        grid.Column("FirstName", "Name", style:"textCol"),
        grid.Column("LastName", "Surname", style:"textCol"),
        grid.Column("DateOfBirth", "Date Of Birth", d => d.DateOfBirth.ToString("MM/dd/yyyy"), style:"dateCol"),
        grid.Column("PassportSeries", "Passport Series", style:"textCol"),
        grid.Column("PassportNumber", "Passport Number", style: "numberCol")
    ))

@section scriptClients {
    <script src="@Url.Content("~/Scripts/clientsIndex.js")" type="text/javascript"></script>
}